package com.zyit.mapper;

import com.zyit.model.Patient;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

public interface PatientMapper {

    @Insert("insert into patient (name, birthday, sex, address, phone, id_card, is_medicare, id_medicare)" +
            " values (#{name},#{birthday},#{sex},#{address},#{phone},#{idCard},#{isMedicare},#{idMedicare})")
    int add(Patient patient);


    @Delete("delete from patient where id = #{id}")
    int del(String id);

    @Select("select count(*)  from patient where id_card = #{idCard} ")
    int findByIdCard(String idCard);

    @Select("select count(*)  from patient where id_medicare = #{idMedicare} ")
    int findByIdMedicare(String idMedicare);

    @Select("select * from patient where id_card = #{idCard}")
    Patient findByIdCardReturn(String idCard);
}
